/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.scm.lcm.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import merlion.mrp.ppm.entity.Product;
import merlion.scm.icm.entity.WarehouseLocation;

/**
 *
 * @author Yuwei
 */

@Entity
public class LogisticItemLine implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private double pickingQty;
    private double packingQty;
    private String description;
    private Integer packingContainerId;
    private String batchNo;
    private double shippingQty;
    //private List<Integer> containerList;
    private String containerListStr;
    private Long qtyOrdered;
    private Long qtyShipped;
    @OneToOne(targetEntity=WarehouseLocation.class, cascade={CascadeType.PERSIST,CascadeType.MERGE}, fetch=FetchType.EAGER)
    private WarehouseLocation warehouseLoc;
    @ManyToOne(targetEntity=Product.class, cascade={CascadeType.PERSIST,CascadeType.MERGE}, fetch=FetchType.EAGER)
    private Product product;
    
    public LogisticItemLine(){
        packingContainerId = 0;
        pickingQty = 0D;
        packingQty = 0D;
        shippingQty = 0D;
        description = "";
        batchNo = "";
        product = new Product();
        //containerList = new ArrayList<Integer>();
        containerListStr = "";
        qtyOrdered = 0L;
        qtyShipped = 0L;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getContainerListStr() {
        return containerListStr;
    }

    public void setContainerListStr(String containerListStr) {
        this.containerListStr = containerListStr;
    }
    
    public Long getQtyOrdered() {
        return qtyOrdered;
    }

    public void setQtyOrdered(Long qtyOrdered) {
        this.qtyOrdered = qtyOrdered;
    }

    public Long getQtyShipped() {
        return qtyShipped;
    }

    public void setQtyShipped(Long qtyShipped) {
        this.qtyShipped = qtyShipped;
    }
//    
//    public List<Integer> getContainerList() {
//        return containerList;
//    }
//
//    public void setContainerList(List<Integer> containerList) {
//        this.containerList = containerList;
//    }
//    
    public double getShippingQty() {
        return shippingQty;
    }

    public void setShippingQty(double shippingQty) {
        this.shippingQty = shippingQty;
    }
    
    public double getPackingQty() {
        return packingQty;
    }

    public void setPackingQty(double packingQty) {
        this.packingQty = packingQty;
    }
    
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getBatchNo() {
        return batchNo;
    }

    public void setBatchNo(String batchNo) {
        this.batchNo = batchNo;
    }

    public double getPickingQty() {
        return pickingQty;
    }

    public void setPickingQty(double pickingQty) {
        this.pickingQty = pickingQty;
    }

    public Integer getPackingContainerId() {
        return packingContainerId;
    }

    public void setPackingContainerId(Integer packingContainerId) {
        this.packingContainerId = packingContainerId;
    }

    

    public WarehouseLocation getWarehouseLoc() {
        return warehouseLoc;
    }

    public void setWarehouseLoc(WarehouseLocation warehouseLoc) {
        this.warehouseLoc = warehouseLoc;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof LogisticItemLine)) {
            return false;
        }
        LogisticItemLine other = (LogisticItemLine) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "merlion.scm.lcm.entity.LogisticItemLine[ id=" + id + " ]";
    }
    
}
